package views.screens.nightScreens;

import java.awt.Component;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import views.MafiaFrame;
import views.panes.ButtonUserNoSound;
import views.panes.ButtonUserNoVote;
import views.screens.Screen;

class nightScreen3 extends JPanel implements Screen{

    int nrRows, nrCols;
    MafiaFrame mafiaFrame;
    nightScreen1 ns1;
    String action1, action2;

    public nightScreen3(final MafiaFrame mf, final String action1, String action2, final nightScreen1 ns1) {
        super(new GridLayout(3,2));
        this.mafiaFrame = mf;
        this.ns1 = ns1;
        this.action1 = action1;
        this.action2 = action2;

        add(new JLabel("Chose your action type: "));
        add(new Component() {     });

        add(new ButtonUserNoSound(this));
        add(new ButtonUserNoVote(this));
        
        for(int i=1; i<nrCols;i++)
        add(new Component() {});
        JPanel jp = new JPanel();
        JButton cancel = new JButton("Back");

        jp.add(cancel);
        add(jp);

        cancel.addMouseListener(new MouseListener() {

            @Override
            public void mouseClicked(MouseEvent e) {
                mf.update(new nightScreen2(mf, action1, ns1));
            }

            @Override
            public void mousePressed(MouseEvent e) {
            }

            @Override
            public void mouseReleased(MouseEvent e) {
            }

            @Override
            public void mouseEntered(MouseEvent e) {
            }

            @Override
            public void mouseExited(MouseEvent e) {
            }
        });
    }
    
    @Override
    public void setAction(String action) {
        mafiaFrame.update(new nightScreen4(mafiaFrame, action1, action2, action, ns1));
    }

}
